import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from "@dfeidao/atom-web/render/render";
import p001 from './p001';
export default async function a001(fd: IFeidaoAiBrowserComponent) {/*搜索 */
	// todo
	console.log('zj-000003:a001-----start');
	// 获取隐患源特性名称
	const n = fd.data.node.querySelector<HTMLInputElement>('[data-id="hidden_source_feature_name"]');// 获取输入查询的内容
	const v = n.value;
	console.log(v);

	// 获取控制数据
	const cd = fd.data.node.querySelector<HTMLSelectElement>('[data-id="control_data"]');
	let cdv = cd.value;
	console.log(cdv);
	if (cdv === "全部") {
		cdv = "";
	}
	// 搜索
	const res = await nodejs<{ res: Array<{}>; c: number }>('wyf/zj-000003/s001', {
		filter: {
			hidden_source_feature_name: v,
			control_data: cdv,
			pn: 1
		}
	});
	console.log(res);
	render(fd, res, p001, 'p001', 'inner');

	console.log('zj-000003:a001-----end');
}
